<!DOCTYPE html>
<html>
<head>
    <title>自主维护工单</title>
    #parse("sys/header.html")
    <style>
        .ui-jqgrid {
            width: 100%;
            float: right;
        }

        .leftHeight{
            height: 85vh;
            overflow: auto;
        }
        ::-webkit-scrollbar{
            width: 10px;
            height: 10px;
        }
        ::-webkit-scrollbar-thumb{
            border-radius: 10px;
            -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
            background: #a8a5a5;
        }
        .workShop{
            position: absolute;
            top: 0;
            width: 90%;
            height: 25px;
            background-color: white;
        }
        .repairCss{
           display: none;
            margin: 20px;
        }
        .repairCss::-webkit-scrollbar{
           display: none;
        }
        .personnelCss{
            overflow: auto;
            height:200px
        }
        .personnelCss::-webkit-scrollbar{
            /*display: none;*/
            width: 10px;
            height: 10px;
        }
        .personnelSelect{
            margin: 0px 3px 5px 3px;
            /*padding: 0px 3px 3px 3px;*/

        }
        .personnelMari{
            text-align: center;
            width: 90px;
        }
        .inputcss{
            border: 1px solid #E1E1E1;
            padding: 3px;
            min-height: 35px;
        }
        .selectRepaiNumber{
            padding-left: 3px;
            padding-right: 3px;
            margin-bottom: 15px;
        }
    </style>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <Row :gutter="16" style="margin: 8px 0px 0px 1px">
            <div class="search-group">
                <i-col span="4">
                    <i-input v-model="q.name" @on-enter="query" placeholder="设备名称"/>
                </i-col>
                <i-col span="4">
                    <i-input v-model="q.repairCode" @on-enter="query" placeholder="工单号"/>
                </i-col>
                <i-col span="3">
                    <Date-picker type="date" v-model="q.executeTime" show-week-numbers placeholder="请选择工单执行周次"></Date-picker>
                </i-col>
                <i-col span="3">
                    <i-select v-model="q.status" placeholder="工单状态">
                        <i-option v-for="ticketStatus in ticketStatusList" :value="ticketStatus.value" :key="ticketStatus.value">{{ticketStatus.name}}</i-option>
                    </i-select>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
        </Row>
        <Row :gutter="16" style="margin: 3px 0px 0px 0px;">
            <div class="buttons-group">

                <i-button type="warning" @click="urge"><i class="fa fa-trash-o"></i>&nbsp;催办</i-button>
                <i-button type="error" @click="applyChange"><i class="fa fa-trash-o"></i>&nbsp;延期申请</i-button>
                <i-button type="primary" @click="delayApply"><i class="fa fa-trash-o"></i>&nbsp;延期审核</i-button>
                <i-button type="info" @click="addError"><i class="fa fa-trash-o"></i>&nbsp;异常添加</i-button>
                #if($shiro.hasPermission("devAmTicket:addExecuteUser"))
                <i-button type="info" @click="dispatchTicket"><i class="fa fa-trash-o"></i>&nbsp;派工</i-button>
                #end
                #if($shiro.hasPermission("devAmTicket:cancel"))
                <i-button type="info" @click="cancelOrderOpen"><i class="fa fa-trash-o"></i>&nbsp;取消</i-button>
                #end
                #if($shiro.hasPermission("devAmTicket:approve"))
                    <i-button type="error" @click="approveCancel"><i class="fa fa-trash-o"></i>&nbsp;审核</i-button>
                #end
            </div>
        </Row>
        <Row  :gutter="16" style="margin: 8px 0px 0px 1px;">
            <i-col :xs="3" :sm="3" :md="3" :lg="3">
                <div class="leftHeight" >
                    <div class="workShop">
                        <p class="text-center" style="font-size: 15px;">工厂/基地</p>
                    </div>
                    <div id="storeLayer" style="margin-top: 25px">
                        <ul id="storeTree" class="ztree"></ul>
                    </div>
                </div>
            </i-col>
            <i-col :xs="21" :sm="21" :md="21" :lg="21">
                <table  id="jqGrid"></table>
            </i-col>
        </Row>

    </div>

    <Card v-show="showForm">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="devPlanGc" :rules="ruleValidate" :label-width="80">

            <Row>
                <i-col span="11">
                    <Form-item label="维护项" prop="createDate">
                        <i-input v-model="devPlanGc.createDate" placeholder="创建时间"/>
                    </Form-item>
                </i-col>
                <i-col span="11">
                    <Form-item label="开始时间" prop="deptCode">
                        <i-input v-model="devPlanGc.deptCode" placeholder="车间编码"/>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="结束时间" prop="devOption">
                        <i-input v-model="devPlanGc.devOption" placeholder="规程库ID"/>
                    </Form-item>
                </i-col>
                <i-col span="11">
                    <Form-item label="维护规程ID" prop="devGc">
                        <i-input v-model="devPlanGc.devGc" placeholder="维护规程ID"/>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="维护计划ID" prop="devPlan">
                        <i-input v-model="devPlanGc.devPlan" placeholder="维护计划ID"/>
                    </Form-item>
                </i-col>
            <i-col span="11">
                <Form-item label="工序号" prop="devProceNo">
                    <i-input v-model="devPlanGc.devProceNo" placeholder="工序号"/>
                </Form-item>
            </i-col>
            </Row>
            <Row>
            <i-col span="22">
                <Form-item label="问题描述" prop="problemDescribe">
                    <i-input v-model="devPlanGc.problemDescribe" placeholder="问题描述"/>
                </Form-item>
            </i-col>
            </Row>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
                <i-button type="info" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>
    <!-- 派工时维修工列表 -->
    <div id="select" class="repairCss" >
        <i-form :label-width="60">
            <Form-item label="维护人员" prop="executor">
                <i-col span="22">
                    <div class="inputcss">
                    <Row type="flex">
                        <div   v-for="(item,index) in mainPersonnel" style="margin-right: 3px;margin-bottom: 3px">
                            <i-col span="24">
                                <div>
                                    <i-button  type="primary" @click="pointPopup(item,index)">
                                        {{item.name}}
                                        <i class="fa fa-trash-o"></i>
                                    </i-button>
                                </div>
                            </i-col>
                        </div>
                    </Row>
                    </div>
<!--                    <i-select v-model="ticketDispatchParam.executor" class="form-input" multiple>-->
<!--                        <i-option v-for="item in repairUserList" :value="item.userId" :key="item.userId">-->
<!--                            {{item.nickName + '(' + item.userName + ')'}}-->
<!--                        </i-option>-->
<!--                    </i-select>-->
                </i-col>
            </Form-item>
            <Form-item>
                <div class="personnelCss" >
                    <Row type="flex"  >
                        <div v-for="(item,index) in repairUserList">
                            <i-col span="24">
                               <div class="personnelSelect">
                                   <i-button :type="repairUserList[index].isShow?'primary':''"  size="large" @click="pointPersonnel(item)">
                                       <div class="personnelMari">
                                           {{item.nickName + '(' + item.userName + ')'}}
                                       </div>
                                   </i-button>
<!--                                {{item.nickName + '(' + item.userName + ')'}}-->
                              </div>
                            </i-col>
                        </div>
                    </Row>
                </div>
            </Form-item>
        </i-form>
    </div>
    <div id="apply" style="display: none;padding:10px;">
        <i-form :label-width="120">
            <Row>
                <i-col span="11">
                    <Form-item label="延期时间">
                        <Date-picker type="date" :options="option" v-model="ticketChangeParam.changeTime"  placeholder="请选择计划延期时间" />
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="22">
                    <Form-item label="事项">
                        <i-input type="textarea" v-model="ticketChangeParam.item" placeholder="变更事项"></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="22">
                    <Form-item label="原因">
                        <i-input type="textarea" v-model="ticketChangeParam.reason" placeholder="问题描述"></i-input>
                    </Form-item>
                </i-col>
            </Row>
        </i-form>
    </div>
    <div id="applySwitch" style="display: none;padding:10px;">
        <i-form :label-width="120">
            <Row>
                <i-col span="11">
                    <Form-item label="审核状态">
                        <Radio-group v-model="delayCheckParam.approvalStatus">
                            <Radio :label="5"><span>通过</span></Radio>
                            <Radio :label="4"><span>不通过</span></Radio>
                        </Radio-group>
                    </Form-item>
                </i-col>
            </Row>
        </i-form>
    </div>
    <!--取消工单-->
    <Modal v-model="cancelModal" width="600" :closable="false">
        <p slot="header" style="color:rgba(0,0,0,0.99);">
            <span>取消工单</span>
        </p>
        <div style="padding-bottom: 5px;color: #0C0C0C">
            本次将取消以下工单列表：请核对
        </div>
        <div class="selectRepaiNumber">
            <Row>
                <i-col v-for="ticketItem in ticketIdLists" span="8" style="text-align: center;padding-top: 5px;">{{ticketItem.repairCode}}</i-col>
            </Row>
        </div>
        <div >
            <i-form
                    ref="cancelOrderValidate"
                    :model="cancelOrderForm"
                    :rules="cancelOrderRules"
                    :label-width="5"
            >
                <Form-item  label="" prop="remark">
                    <i-input v-model="cancelOrderForm.remark" type="textarea" :autosize="{minRows: 2,maxRows: 5}" placeholder="请输入取消原因，必填"></i-input>
                </Form-item>
            </i-form>
        </div>
        <div slot="footer">
            <i-button  size="large"  @click="cancelOrderModal">取消</i-button>
            <i-button type="primary" size="large"   @click="cancelOrderOk">确定</i-button>
        </div>
    </Modal>
</div>
<script src="${rc.contextPath}/js/device/devAmTicket.js?_${date.systemTime}"></script>
</body>
</html>
